<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Goods extends Model
{
    //
    protected $table = "goodses";

    public function cate()
    {
        return $this->belongsTo("\App\Cate");
    }

    public function goodsNorms()
    {
        return $this->hasMany("\App\GoodsNorm");
    }

    public function goodsImages()
    {
        return $this->hasMany("\App\GoodImage");
    }

    public function hotGoods()
    {
        return self::where("is_hot",1)->get();
    }

    public function best()
    {
        return self::where("is_best",1)->first();
    }
    public function is_new()
    {
        return self::where("is_new",1)->get();
    }
}
